package com.example.demo.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FanoutSender {
    @Autowired
    private AmqpTemplate amqpTemplate;
    public void send() throws Exception{
        String context="李兴振 的 Fanout Demo";
        System.out.println("Sender:"+context);
        this.amqpTemplate.convertAndSend("fanoutExchanger","",context);
    }
}
